<?php
namespace app\api\validate;
use think\Validate;

class User extends Validate {
     protected  $rule = [
         'username'=>'require',
         'phone_number'=>'require',
         'code'=>'require|number|min:4',
         'type'=>['require','in'=>"1,2"]
     ];
     protected  $message = [
         'username'=>'用户名称不能为空',
         'phone_number'=>'手机号不能为空',
         'code.require'=>'验证码不能为空',
         'code.code'=>'验证码必须是数字',
         'code.min'=>'验证码长度大于4位',
         'type.require'=>'类型不能为空',
         'type.in'=>'类型错误',
     ];
     //场景
     protected  $scene = [
         'send_code'=>['phone_number'],
         'login'=>['phone_number','code','type']
     ];
}
